package com.caration.shell;

import com.caration.shell.item.ItemInfo;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;

public class DbHelper {
	public static void a(Context context, ContentValues contentvalues, a a1) {
		context.getContentResolver().update(com.tsf.shell.ch.a(a1.a),
				contentvalues, null, null);
	}

	public static void a(Context context, a a1) {
		ContentValues contentvalues = new ContentValues();
		ContentResolver contentresolver = context.getContentResolver();
		a1.a(contentvalues);
		contentresolver.update(com.tsf.shell.ch.a(a1.a), contentvalues, null,
				null);
	}

	public static void a(Context context, a a1, int i, int j, int k) {
		a1.c = -1;
		a1.d = i;
		a1.e = j;
		a1.f = k;
		Uri uri = com.tsf.shell.ch.a(a1.a);
		ContentValues contentvalues = new ContentValues();
		ContentResolver contentresolver = context.getContentResolver();
		contentvalues.put("container", Integer.valueOf(a1.c));
		contentvalues.put("cellX", Integer.valueOf(a1.e));
		contentvalues.put("cellY", Integer.valueOf(a1.f));
		contentvalues.put("screen", Integer.valueOf(a1.d));
		ShellModel.c().post(new bc(contentresolver, uri, contentvalues));
	}

	public static void a(g g1) {
		Object obj = new ContentValues();
		ContentResolver contentresolver = com.censivn.C3DEngine.a.e()
				.getContentResolver();
		g1.a(((ContentValues) (obj)));
		g1.b();
		obj = contentresolver.insert(ch.b, ((ContentValues) (obj)));
		if (obj != null)
			g1.a = Integer.parseInt((String) ((Uri) (obj)).getPathSegments()
					.get(1));
	}

	public static byte[] a(a a1)
	    {
	        Cursor cursor = com.censivn.C3DEngine.a.e().getContentResolver().query(com.tsf.shell.ch.a(a1.a), null, null, null, null);
	        byte abyte0[];
	        cursor.moveToNext();
	        abyte0 = cursor.getBlob(cursor.getColumnIndexOrThrow("data"));
	        abyte0 = abyte0;
	        cursor.close();
	_L2:
	        return abyte0;
	        JVM INSTR pop ;
	        abyte0 = null;
	_L3:
	        cursor.close();
	        if(true) goto _L2; else goto _L1
	_L1:
	        JVM INSTR pop ;
	          goto _L3
	    }

	public static void deleteItemInfo(Context context, ItemInfo item) {
		final ContentResolver resolver = context.getContentResolver();
		final Uri uri = DatabaseStruct.Favorites.getContentUri(item.mId, false);
		item.a();
		ShellModel.postRunnable(new Runnable() {
			@Override
			public void run() {
				resolver.delete(uri, null, null);
			}
		});
		item.c();
	}
}
